﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Text;

namespace HSIA
{
    public class AmateEventArgs : EventArgs
    {
        public AmateEventArgs()
        {
            strIDs = "";
            Value = "";
        }
        public string strIDs;
        public int Key;
        public string Value;
        public object oParam;
    }

    public delegate void AmateEventHandler(object sender, AmateEventArgs e);
    public delegate void ChartTypeChanged(int iIndex);
    public delegate void SetTimer(bool bl);
    //public delegate void MapSet(UCArea area,int iType);
    public delegate void RegisterEvent(string s);
    public delegate void FormClose();
    //public delegate void MapEnterLeave(UCArea area, int iType);
    //public delegate void StatusLabelChanged(int iIndex,string sInfo);

    public class EventHandle
    {
        public event AmateEventHandler SensorEdited;
        public event AmateEventHandler MDIChildClosed;
        public event AmateEventHandler StatusLabelChanged;
        //public event AmateEventHandler ChartTypeChanged;

        protected virtual void OnCheckout(string strEvent, AmateEventArgs e)
        {
            switch (strEvent)
            {
                case "SensorEdited": if (SensorEdited != null) SensorEdited(this, e); break;
                case "MDIChildClosed": if (MDIChildClosed != null) MDIChildClosed(this, e); break;
                case "StatusLabelChanged": if (StatusLabelChanged != null) StatusLabelChanged(this, e); break;
                //case "ChartTypeChanged": if (ChartTypeChanged != null) ChartTypeChanged(this, e); break;   
                default : break;
            }
        }

        public void InvokeEvent(string strEvent, AmateEventArgs e)
        {
            OnCheckout(strEvent, e);
        }
    }
}
